<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<script type="text/javascript">
	var grid = null;
	var _mfrId;
	var orgCdNm;
	var insUseCdNm;
	var prjTypeCdNm;
	$(function () {
			//机构用途
		   insUseCdNm = $("#insUseCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
           	   data: [
	                {  name: 'key', width: 100}, 
	                {  name: 'value', width: 120},
	               ],
	            url:'<%=path%>/rfbase/fribaseinfo/getInsUseCd.do',
	            ajaxType :'GET',
	            slide: false,
	            valueField: 'key', textField: 'value',
	            valueFieldID: 'insUseCd'
           });
		   
		   //支持的项目类型	
		   prjTypeCdNm = $("#prjTypeCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
           	   data: [
	                {  name: 'key', width: 100}, 
	                {  name: 'value', width: 120},
	               ],
	            url:'<%=path%>/rfbase/fundInsMgr/getPrjTypeCd.do',
	            ajaxType :'GET',
	            slide: false,
	            valueField: 'key', textField: 'value',
	            valueFieldID: 'prjTypeCd'
           });
		   
		   //所属事业部
		   orgCdNm = $("#orgCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
           	   data: [
	                {  name: 'key', width: 100}, 
	                {  name: 'value', width: 120},
	               ],
	            url:'<%=path%>/rfbase/fundInsMgr/getOrgCd.do',
	            ajaxType :'GET',
	            slide: false,
	            valueField: 'key', textField: 'value',
	            valueFieldID: 'orgCd'
           });
		   
		   
		var _url = '<%=path%>/rfbase/fundInsMgr/initList.do' ;
	    $("#ligergrid1").ligerGrid({
	    	url: _url,
	    	method : 'get',
	        columns: [
	            { display: '资管机构全称', name: 'fundRasInsNm', align:'center' },
	            { display: '机构编码', name: 'insCode', align:'center' },
	            { display: '机构用途', name: 'insUseCdNm', align:'center'},
	            { display: '支持的项目类型', name: 'prjTypCdsNm', align:'center'  },
	            { display: '所属事业部', name: 'buOrgCdsNm',align:'center'},
	           
	        ],
	        pageSize:10,
	    	checkbox: true,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        rownumbers:true,
	        fixedCellHeight:false,
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         var insUseCd = $("#insUseCd").val();
        	 data["insUseCd"]=insUseCd;
        	 data["orgCd"]=$("#orgCd").val();
        	 data["prjTypeCd"]=$("#prjTypeCd").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	    
	});

  	
  	
  	//机构添加
	function add(){
		$.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 700,
            height:600,
            title : '添加机构',
           url:'<%=path%>/rfbase/fundInsMgr/toAddNewListPage.do',
        });
		
	}
	
	
	
	//机构编辑
	function update(){
		var selectedRows = grid.getSelectedRows();
        if (selectedRows.length != 1) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
            return;
        }
		     
        var timestamp=new Date().getTime();
		var param = '<%=path%>/rfbase/fundInsMgr/toModifyNew.do?id='+selectedRows[0].id;
		Add_navTab('fundInsMgrAdd'+timestamp,'机构编辑',param, function () {
			grid.reload();
		});
	}
	
	

	

	//清空按钮事件
	function clearBtn() {
		$("#resetBtn").click(); //重置 input-text
		var form = new liger.get("searchBar");
		form.setData({ //重置select等特殊表单
			"fundRasInsNm" : "",
			"insSts" : "",
			"stDt" : "",
			"edDt" : "",
			"crSt" : "",
			"insUseCd":"",
			"insUseCdNm":"",
			"orgCd":"",
			"orgCdNm":"",
			"prjTypeCd":"",
			"prjTypeCdNm":"",
		});
		
		if(orgCdNm) orgCdNm.clear();
		if(insUseCdNm) insUseCdNm.clear();
		if(prjTypeCdNm) prjTypeCdNm.clear();
	}

	
</script>

<body class="iframeBody">
	<div class="Wrapper">
		<div class="searchArea">
			<form id="searchBar">
				<div class="fieldset1 clearFix">
					<div class="fieldBox">
						<div class="label">资管机构全称</div>
						<div class="field">
							<input name="fundRasInsNm" id="fundRasInsNm" type="text" class="ui-textbox" value="">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">机构编码</div>
						<div class="field">
							<input name="insCode" id="insCode" type="text" class="ui-textbox" value="">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">机构用途：</div>
						<div class="field">
							<input type="text"  name="insUseCdNm" id="insUseCdNm"  class="ui-textbox" >
							<input type="hidden" name="insUseCd" id="insUseCd" data-ligerid="insUseCdNm" value="">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">支持的项目类型：</div>
						<div class="field">
							<input type="text"  name="prjTypeCdNm" id="prjTypeCdNm"  class="ui-textbox" >
							<input type="hidden" name="prjTypeCd" id="prjTypeCd" data-ligerid="prjTypeCdNm" value="">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">所属事业部：</div>
						<div class="field">
							<input type="text"  name="orgCdNm" id="orgCdNm"  class="ui-textbox" >
							<input type="hidden" name="orgCd" id="orgCd" data-ligerid="orgCdNm" value="">
						</div>
					</div>
					<div class="clearFix"></div>
					<div class="btnsBox formBtns notRight">
						<span id="searchBtn" class="sq-button-round">查询</span>
						<span id="clearBtn" class="sq-button-round" onclick="clearBtn();">清空</span>
						<span id="" class="sq-button-round" onclick="update();">机构编辑</span>
						<span id="" class="sq-button-round" onclick="add();">机构添加</span>
						<input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide" />
					</div>
			</form>
		</div>
	</div>
	<div id="ligergrid1" class="sq-grid"></div>


</body>
</html>
